package cn.dai.service.model;

import java.util.List;

/**
 * @author ArkD42
 * @file Paging
 * @create 2020 - 06 - 04 - 7:57
 */
public class Page<T> {

    // 总记录数量
    private Long totals;

    // 每页记录数量
    private int pageSize;

    // 总页数
    private int totalPages;

    // 起始的页码值
    private int pageIndex;

    // 当前页的记录集合
    List<T> currentList;

    public Long getTotals() {
        return totals;
    }

    public void setTotals(Long totals) {
        this.totals = totals;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPages() {
        return totalPages;
    }

    // 总页数由总记录除以总页数获得
    public void setTotalPages(int pageSize) {
        int totalPages = (int) (this.totals / pageSize);

        this.totalPages =
                this.totals % pageSize == 0 ? totalPages : totalPages + 1;
    }

    public int getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }

    public List<T> getCurrentList() {
        return currentList;
    }

    public void setCurrentList(List<T> currentList) {
        this.currentList = currentList;
    }


}
